<% layout('/layouts/default.html', {title: '供应商档案管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('供应商档案管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('st:stSupplierRecord:edit')){ %>
					<a href="${ctx}/st/stSupplierRecord/form" class="btn btn-default btnTool" title="${text('新增供应商档案')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${stSupplierRecord}" action="${ctx}/st/stSupplierRecord/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('供应商编号')}：</label>
					<div class="control-inline">
						<#form:input path="supplierCode" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('全称')}：</label>
					<div class="control-inline">
						<#form:input path="supplierFullName" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('简称')}：</label>
					<div class="control-inline">
						<#form:input path="supplierSimpleName" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('类型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="supplierType" dictType="st_supplier_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('结算方式')}：</label>
					<div class="control-inline width-120">
						<#form:select path="calcType" dictType="st_custom_calc_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('默认税率')}：</label>
					<div class="control-inline">
						<#form:input path="defaultRate" maxlength="36" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('付款账期')}：</label>
					<div class="control-inline">
						<#form:input path="payTime" maxlength="36" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('默认币别')}：</label>
					<div class="control-inline width-120">
						<#form:select path="moneyType" dictType="st_money_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('等级')}：</label>
					<div class="control-inline width-120">
						<#form:select path="supplierLevel" dictType="st_supplier_level" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('地区')}：</label>
					<div class="control-inline">
						<#form:input path="area" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('纳税号')}：</label>
					<div class="control-inline">
						<#form:input path="payTaxNumber" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('地址电话')}：</label>
					<div class="control-inline">
						<#form:input path="addressPhone" maxlength="40" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('主营范围')}：</label>
					<div class="control-inline">
						<#form:input path="mainProduct" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('有效')}：</label>
					<div class="control-inline width-120">
						<#form:select path="effect" dictType="st_effect" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('备注')}：</label>
					<div class="control-inline">
						<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('启用供应链系统')}：</label>
					<div class="control-inline">
						<#form:input path="useSupplyChain" maxlength="1" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("供应商编号")}', name:'supplierCode', index:'a.supplier_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/st/stSupplierRecord/form?id='+row.id+'" class="btnList" data-title="${text("编辑供应商档案")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("全称")}', name:'supplierFullName', index:'a.supplier_full_name', width:150, align:"left"},
		{header:'${text("简称")}', name:'supplierSimpleName', index:'a.supplier_simple_name', width:150, align:"left"},
		{header:'${text("类型")}', name:'supplierType', index:'a.supplier_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_supplier_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("结算方式")}', name:'calcType', index:'a.calc_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_custom_calc_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("默认税率")}', name:'defaultRate', index:'a.default_rate', width:150, align:"left"},
		{header:'${text("付款账期")}', name:'payTime', index:'a.pay_time', width:150, align:"left"},
		{header:'${text("默认币别")}', name:'moneyType', index:'a.money_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_money_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("等级")}', name:'supplierLevel', index:'a.supplier_level', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_supplier_level')}, val, '${text("未知")}', true);
		}},
		{header:'${text("地区")}', name:'area', index:'a.area', width:150, align:"left"},
		{header:'${text("纳税号")}', name:'payTaxNumber', index:'a.pay_tax_number', width:150, align:"left"},
		{header:'${text("地址电话")}', name:'addressPhone', index:'a.address_phone', width:150, align:"left"},
		{header:'${text("主营范围")}', name:'mainProduct', index:'a.main_product', width:150, align:"left"},
		{header:'${text("有效")}', name:'effect', index:'a.effect', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_effect')}, val, '${text("未知")}', true);
		}},
		{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text("启用供应链系统")}', name:'useSupplyChain', index:'a.use_supply_chain', width:150, align:"center"},
		{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('st:stSupplierRecord:edit')){ %>
				actions.push('<a href="${ctx}/st/stSupplierRecord/form?id='+row.id+'" class="btnList" title="${text("编辑供应商档案")}"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/st/stSupplierRecord/delete?id='+row.id+'" class="btnList" title="${text("删除供应商档案")}" data-confirm="${text("确认要删除该供应商档案吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>